<!DOCTYPE html>
<html lang="en">
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Test For DataU</title>
    <script type="text/javascript" src="/js/jquery-1.11.3.js"></script>
    <link href="/css/globle.css" rel="stylesheet"/>
    <script>
        $(function () {
            checkUrl();
        });

        function checkUrl() {
            $(".a_url").each(function () {
                var url = $(this).attr("href");
                checkOneUrl(url, this);
            })
        }

        function checkOneUrl(url, dom) {
            $.ajax({
                type: "get",
                url: "/project/checkUrl?url="+url,
                dataType:'text',
                success: function (msg) {
                    if (msg === "200") {
                        $(dom).text("web访问成功");
                    } else {
                        $(dom).text(msg);
                    }
                }
            });
        }

    </script>
</head>
<body>

<div th:include="header"></div>
<br>

<h2>Projects</h2>

<div>
    <a href="/project/findAllListShowServers/?serverTypeId=1">生产环境</a>
    <a href="/project/findAllListShowServers?serverTypeId=2">测试环境</a>
    <a href="/project/findAllListShowServers?serverTypeId=3">线上环境</a>
</div>

<!-- 消息列表 -->
<div class="box_bd" id="messageList">
    <!-- 循环遍历群聊，显示在此 -->
    <table cellspacing=0 cellpadding=4 id="table-1">
        <tr>
            <th>项目类别</th>
            <th>项目名</th>
            <th>ip</th>
            <th>端口</th>
            <th>访问路径</th>
            <th>能否访问</th>
            <th>域名</th>
            <th>初始内存</th>
            <th>最大内存</th>
            <th>所在服务器</th>
            <th>描述</th>
        </tr>
        <tr th:each="p:${projects}">
            <td th:text="${p.type.name}">项目类别</td>
            <td th:text="${p.name}">项目名</td>
            <td th:text="${p.ip}">ip</td>
            <td th:text="${p.port}">端口</td>
            <td th:text="${p.address}">访问路径</td>
            <td><a class="a_url" th:href="'http://'+${p.ip}+':'+${p.port}+${p.address}" target="_blank">测试中......</a></td>
            <td th:text="${p.domain}">域名</td>
            <td th:text="${p.memoryInit}">初始内存</td>
            <td th:text="${p.memoryMax}">最大内存</td>
            <td>
                <span th:each="s,iterStat:${p.servers}">
                    <span th:text="${s.ip}">所在服务器</span>
                    <br th:if="!${iterStat.last}"/>
                </span>
            </td>
            <td th:text="${p.desc}">描述</td>
        </tr>
    </table>

</div>

</body>
</html>